#include <bits/stdc++.h>

using namespace std;

class Solution {
   public:
    int maximizeSum(vector<int>& nums, int k) {
        int num = 0;
        for (int i = 0; i < nums.size(); ++i) {
            num = max(num, nums[i]);
        }
        return (num + num + k - 1) * k / 2;
    }
};